﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using NUnit.Framework;
using Rhino.Mocks;
using TSVNAddin.SVN;

namespace TSVNAddin.Core.Test
{
	[TestFixture]
	public class PathAddedActionFixture
	{
		[Test]
		public void NotifyAddedOnFile()
		{
			var versionControl = MockRepository.GenerateMock<IVersionControl>();

			var action = new PathAddedAction(versionControl, null);
			action.Execute(@"c:\ciccio.cs");

			versionControl.AssertWasCalled(x => x.Add(@"c:\ciccio.cs"));
		}

		[Test]
		public void NotifyAddedOnDirectory()
		{
			var versionControl = MockRepository.GenerateStub<IVersionControl>();
			var fileStorage = MockRepository.GenerateMock<IFileStorage>();

			var action = new PathAddedAction(versionControl, fileStorage);
			action.Execute(@"c:\root\ciccio\");

			versionControl.AssertWasCalled(x => x.Add(@"c:\root\ciccio\"));
			fileStorage.AssertWasCalled(x => x.DeleteDirectory(@"c:\root\ciccio\.svn"));
		}
	}
}
